<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/reset.css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/main.css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/area.css" />
<script type="text/javascript" src="<c:url value='/scripts/jquery-latest.pack.js'/> " ></script>
<script type="text/javascript" src="<c:url value='/scripts/areaopt.data.js'/>"></script>
<script type="text/javascript">
var submitFlag = true;
function getAcc(){
	if(!submitFlag){
		alert('请求已提交，请稍候');
		return;
	}
	var areaCode = $('#areaCode').val();
	var depCode = $('#dep').val();
	if(depCode == 0){
		alert('请选择部门');
		return;
	}
	var fullDepCode = areaCode+depCode;
	check(fullDepCode);
	
}

function check(fullDepCode){
	submitFlag = false;
	var options={type:"POST", 
			url:"<%=request.getContextPath()%>/user/deptCodeAuth?deptCode="+fullDepCode, 
			dataType:"json", success: checkDeptCodeHandle};
	$.ajax(options);
}

function checkDeptCodeHandle(data,status) {
	submitFlag = true;
	if(status){
		if (data.result == 0){
			var flag = confirm('该部门还未注册帐号，要新注册帐号吗？');
			if(flag){
				openWin(data.msg);
			}
		}
		else{
			var flag = confirm('该部门已注册帐号，要查看帐号信息吗？');
			if(flag){
				openWin(data.msg);
			}
		}
	}
	else{
		alert('通信异常，请联系管理员');
	}
}

function openWin(deptCode){
	var url = '<%=request.getContextPath()%>/user/showAccDetailsByJXW/'+deptCode;
	window.open (url,'帐号详情','height=700,width=980,top=0,left=0,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no, status=no');
}

function init(){
	parent.resizeMainFrame(700);
}
</script>
<style type="text/css">
<!--
.zhengwen {font-family: Arial, Helvetica, sans-serif}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #EFF6FE;
}
-->
</style>
</head>
<body style="margin: 0 auto; height: 100px; background-color: #EFF6FE" onload="init()">
<table class="tdata">
	<tr class="tr01">
		<td align="center" width="10%">
		<h5>序号</h5>
		</td>
		<td align="center" width="20%">
		<h5>国家部委/机构</h5>
		</td>
		<td align="center" width="25%">
		<h5>部门名称</h5>
		</td>
		<td align="center" width="20%">
		<h5>帐号名称</h5>
		</td>
		<td align="center" width="15%">
		<h5>密码</h5>
		</td>
		<td align="center" width="10%">
		<h5>操作</h5>
		</td>
	</tr>
	<tbody>
		<c:forEach items="${accInfos}" var="acc" varStatus="status">
			<tr onmousemove=this.style.backgroundColor='#F1F1F1' onmouseout=this.style.backgroundColor='';>
				<td align="center">${status.index}</td>
				<td class="hiddentd"><c:out value="${acc.industryName}" /></td>
				<td class="hiddentd"><c:out value="${acc.deptName==null?'未注册':acc.deptName}" /></td>
				<td class="hiddentd"><c:out value="${acc.userAccount==null?'未注册':acc.userAccount}" /></td>
				<td class="hiddentd"><c:out value="${acc.userPassword==null?'未注册':acc.userPassword}" /></td>
				<td align="center">
					<c:if test="${acc.userAccount!=null}">
						<a href="<%=request.getContextPath()%>/user/showAccDetailsByJXW/${acc.deptCode}">修 改</a>
					</c:if>
					<c:if test="${acc.userAccount==null}">
						<a href="<%=request.getContextPath()%>/user/showAccDetailsByJXW/${acc.deptCode}">新 增</a>
					</c:if>
				</td>
			</tr>
		</c:forEach>
	</tbody>
</table>
</body>
</html>